# -*- coding: utf-8 -*-
"""
author:码同学 极光
date:2024/3/17
desc: 
sample: 
"""
def do_something1(a1,a2):
    print(f"type_a {type(a1)}, type_a2 {type(a2)} a1={a1}, a2={a2}");

#python特有的
# do_something1(a2='test',a1=1)
# do_something1(1,"test")

#缺省参数
def do_something2(a1,a2=10):
    print(f"type_a {type(a1)}, type_a2 {type(a2)} a1={a1}, a2={a2}");

# do_something2(a2='test',a1=1)
# do_something2(1,"test")
# do_something2(1)
# do_something2("zhangsan",{"abc","abc"})

#不定长 不能出现关键词 位置参数
print("不定长")
def do_something3(a1, *args):
    print(f"type_a {type(a1)}, type_args {type(args)} a1={a1}, a2={args}")
do_something3(1)
do_something3(1,2,3,4,5)

print("关键词")
#关键词
def do_something4(a1, **kwargs):
    print(f"type_a {type(a1)}, kwargs {type(kwargs)} a1={a1}, kwargs={kwargs}")
do_something4(1)
#do_something4(1,2) #错误
do_something4(2,x=2) #正确
do_something4(1,v1=1,x=11)
do_something4(a1=2,a2=3,x=2)

#万能参数组合
print("万能参数组合")
def do_something5(*args,**kwargs):
    print(f"args {type(args)}, kwargs {type(kwargs)} args={args}, kwargs={kwargs}")

do_something5()
do_something5(11,22)
do_something5(k1=11,k2=22)
do_something5(11,22,k1=11)
do_something5((11,22),k1=11,k2=22)
do_something5((11,22),[1,2],k1=11,k2=22)

print(1,2)
print(1,2,3,4,5)


person ={
  "name": "张三",
  "age": 25,
  "lunch_fee": 19.5,
  "hope_deposit": 10000000000000,
  "dream_come": True
}

do_something5(person)
#字典传参 要变成kv格式特殊用法
result = do_something5(**person)
print(result)